//
//  LocalCell.m
//  KiklinkApp
//
//  Created by LJC on 14-9-10.
//  Copyright (c) 2014年 Kiklink. All rights reserved.
//

#import "LocalCell.h"
#import "UIImageView+WebCache.h"

#import "API.h"

@implementation LocalCell

- (void)awakeFromNib
{
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)loadData
{
    self.image.image = [UIImage imageNamed:@"placeHolder.png"];
    self.titleLabel.text = @"拳击-男人的运动";
    self.subTitleLabel.text = @"激情与汗水";
    self.priceLabel.text = @"1.5";
    self.distanceLabel.text = @"100";
}
- (void)loadData2
{
    self.image.image = [UIImage imageNamed:@"placeHolder.png"];
    self.titleLabel.text = @"跑步-永无止境";
    self.subTitleLabel.text = @"毅力与坚忍";
    self.priceLabel.text = @"150";
    self.distanceLabel.text = @"2000";
}
- (void)loadData3
{
    self.image.image = [UIImage imageNamed:@"placeHolder.png"];
    self.titleLabel.text = @"滑板-速度中的技巧";
    self.subTitleLabel.text = @"少年的逆袭";
    self.priceLabel.text = @"150";
    self.distanceLabel.text = @"100000";
}

- (void)loadDataWithProduct:(Product *)product
{
    self.titleLabel.text = product.name;
    self.subTitleLabel.text = product.subname;
    self.priceLabel.text = [NSString stringWithFormat:@"%ld",(long)product.price];
    self.distanceLabel.text = @"100";
    
    self.image.clipsToBounds = YES;
    [self.image sd_setImageWithURL:[NSURL URLWithString:[Base_Url stringByAppendingString:product.photo]] placeholderImage:[UIImage imageNamed:@"placeHolder.png"]];
}

- (void)loadDataWithFavouriteItem:(FavouriteItem *)favouriteItem
{
    self.titleLabel.text = favouriteItem.targetName;
    self.distanceLabel.text = @"100";
    
    self.image.clipsToBounds = YES;
    [self.image sd_setImageWithURL:[NSURL URLWithString:[Base_Url stringByAppendingString:favouriteItem.targetPhoto]] placeholderImage:[UIImage imageNamed:@"placeHolder.png"]];
    
    
//    [API productDetailWithId:favouriteItem.targetId Callback:^(int stateCode, NSString *word, id content) {
//        
//        if (stateCode == SUCCESS) {
//            
//            Product *product = (Product *)content;
//            self.subTitleLabel.text = product.subname;
//            self.priceLabel.text = [NSString stringWithFormat:@"%ld",(long)product.price];
//            self.distanceLabel.text = @"100";
//            
//            self.titleLabel.text = product.name;
//            self.image.clipsToBounds = YES;
//            [self.image sd_setImageWithURL:[NSURL URLWithString:[Base_Url stringByAppendingString:product.photo]] placeholderImage:[UIImage imageNamed:@"test.jpg"]];
//            
//        } else {
//        }
//        
//    }];
}

@end
